package com.sinaapp.kjWeb.util;

import java.util.Calendar;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
 *auth:徐疆
 *date 2014-1-12 下午11:37:53
 */
public class DateUtil {
	public static Logger logger = LoggerFactory.getLogger(DateUtil.class);
	public static Date getDateFromTime(String time) {
		if(StringUtil.isBlank(time)){
			return null;
		}
		try {
			Calendar calendar = Calendar.getInstance();
			calendar.set(Calendar.HOUR_OF_DAY,
					Integer.parseInt(time.split(":")[0]));
			calendar.set(Calendar.MINUTE, Integer.parseInt(time.split(":")[1]));
			calendar.set(Calendar.SECOND, 0);
			Date stimes = calendar.getTime();
			return stimes;
		} catch (Exception e) {
			logger.error("时间格式不正确,"+time);
		}
		return null;
	}
}
